$(function () {
    $("body").append("<p></p>");

    let bgdata = chrome.extension.getBackgroundPage()
    console.log(bgdata);

    chrome.storage.local.get(['mandatoryMode'], function (result) {
        console.log('Value currently is ' + result.mandatoryMode);
        $('#checkbox')[0].checked = result.mandatoryMode;
    });

    $('#checkbox').on('change', (e) => {
        let theSelected = $('#checkbox').is(':checked');
        bgdata.sendMessageToContentScript({ cmd: 'notice_mandatoryMode', data: theSelected }, null);
    })
});

